<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<script>
		class Vue {
			constructor() {
				this.data = {
					name: '波仔',
					age: 18,
					sex: '男'
				}
				Object.keys(this.data).forEach(key => {
					this.proxyData(key)
				})

			}

			proxyData(key) {
				Object.defineProperty(this, key, {
					get() {
						return this.data[key]
					},
					set(newVal) {
						this.data[key] = newVal
					}
				})
			}
		}
		const demo = new Vue()

		console.log(demo.name)
	</script>
</body>
</html>